package work1;

public class Square extends Graph {
    private double length;

    public Square() {}

    public Square(double length,String color,boolean fill){
        super(color, fill);
        this.length = length;
    }

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    @Override
    double getArea() {
        return length*length;
    }

    @Override
    double getPrimeter() {
        return 4*length;
    }

    @Override
    public String toString() {
        return "正方形的边长为:" + length + ",正方形的颜色为:" + color + ",是否填充颜色:" + (fill? "是":"否") + ",圆的面积为:" + getArea() + ",圆的周长为:" + getPrimeter();
    }
}
